import { Login, SysMail } from "@/api/interface/index";
import { CANROCNET } from "@/api/config/servicePort";
import http from "@/api";

/**
 * 获取当前登录用户的信息
 *
 * @returns 返回当前登录用户的信息
 */
export const getLoginUserInfoApi = () => {
  return http.get<Login.UserInfoResult>(`${CANROCNET}/api/system/login-user-info`, {}, { loading: false });
};

/**
 * 获取当前登录用户的菜单列表
 *
 * @returns 返回菜单列表
 */
export const getLoginUserMenusApi = () => {
  return http.get<Menu.MenuOptions[]>(`${CANROCNET}/api/system/login-user-menu`, {}, { loading: false });
};

/**
 * 获取当前登录用户的按钮权限
 *
 * @returns 返回按钮权限
 */
export const getLoginButtonsApi = () => {
  return http.get<Login.ResAuthButtonsResult>(`${CANROCNET}/api/system/login-user-button`, {}, { loading: false });
};

/**
 * 获取当前用户未读的站内信
 *
 * @returns 返回未读的站内信简短信息列表
 */
export const getUserNoReadMailApi = () => {
  return http.get<SysMail.ShortResult[]>(`${CANROCNET}/api/system/user-no-read-mails`);
};

/**
 * 获取当前站内信信息
 *
 * @returns 返回站站内信信息
 */
export const getMailMessageApi = (mailId: string) => {
  return http.get<SysMail.Result>(`${CANROCNET}/api/system/mail-by-id/${mailId}`);
};
